package company.C58_AC;

public class C2 {

    public int question(int a, int b) {
        // write code here
        int tmp, sqrt;
        for (int i = 0; i < 500; i++) {
            if (isCompletelyFrequent(i + a) && isCompletelyFrequent(i + b))
                return i;
        }
        return -1;
    }

    private boolean isCompletelyFrequent(int num) {
        int sqrt = (int) Math.sqrt(num);
        return num == sqrt * sqrt;
    }
}
